package cn.ilikes.webs.bases;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.ServletActionContext;

import cn.ilikes.webs.webs.uilts.WebUnits;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.MethodFilterInterceptor;

@SuppressWarnings("serial")
public class SessionInterceptor extends MethodFilterInterceptor {
	

	// @Override
	protected String doIntercept(ActionInvocation arg0) throws Exception {

		HttpServletRequest  httpServletRequest =(HttpServletRequest) arg0.getInvocationContext().get(ServletActionContext.HTTP_REQUEST);
		
		
		if (WebUnits.islogin(httpServletRequest)) {
			return arg0.invoke();
		} else {
			return "nologin";
		}
	}

}
